package com.DeliveryProgram.www.constant;

import com.DeliveryProgram.www.po.Business;
import com.DeliveryProgram.www.po.User;

import java.util.List;


public class UScreen {

    /**查看用户个人信息*/
    public static void checkUser(User us){
        System.out.println("用户 "+us.getName());
        System.out.println("余额为 "+us.getMoney()+"元");
        System.out.println("拥有折扣 "+us.getCoupons().size()+ "张");
        System.out.println("拥有订单 "+us.getOrders().size()+" 次");
        System.out.println("评论 "+us.getComments().size()+" 次");
        System.out.println("-------------------------------------");
        System.out.println("0-退出");
        System.out.println("1-充值");
        System.out.println("2-管理我的地址");
        System.out.println("3-查看我的折扣");
        System.out.println("4-查看我的订单");
        System.out.println("5-查看我的评论");

    }

    /**用户管理地址界面*/
    public static void checkAddress(User us){
        for(int i=0;i<us.getAddresses().size();i++){
            System.out.println(i+1+"、 地址"+us.getAddresses().get(i).getAddr()+" | 电话号码:"+us.getAddresses().get(i).getPhone());
        }

    }

    /**用户折扣查看*/
    public static void checkCoupons(User us){
        for(int i=0;i<us.getCoupons().size();i++){
            System.out.println(i+1+"店家： "+us.getCoupons().get(i).getName()+" | 折扣程度："+us.getCoupons().get(i).getDiscount());
        }
        System.out.println("请按0退出");
    }

    /**用户查看订单*/
    public static void checkOrders(User us){
        for(int i=0;i<us.getOrders().size();i++) {
            if (us.getOrders().get(i).getIsComplete() == 1) {
                System.out.println(i + 1 + "店家： " + us.getOrders().get(i).getShop() + " | 未接单 | 价格：" + us.getOrders().get(i).getMoney() + " | 日期：" + us.getOrders().get(i).getDate());
            }else  if (us.getOrders().get(i).getIsComplete() == 2) {
                System.out.println(i + 1 + "店家： " + us.getOrders().get(i).getShop() + " | 已接单 | 价格：" + us.getOrders().get(i).getMoney() + " | 日期：" + us.getOrders().get(i).getDate());
            }else  if (us.getOrders().get(i).getIsComplete() == 3) {
                System.out.println(i + 1 + "店家： " + us.getOrders().get(i).getShop() + " | 已完成 | 价格：" + us.getOrders().get(i).getMoney() + " | 日期：" + us.getOrders().get(i).getDate());
            }
        }
        System.out.println("请按0退出 | 输入订单编号查看详情");
    }

    /**订单详情*/
    public static void detailOder(User us,int num){
        if (us.getOrders().get(num).getIsComplete() == 1) {
            System.out.println("店家： " + us.getOrders().get(num).getShop() + " | 未接单 | 价格：" + us.getOrders().get(num).getMoney() + " | 日期：" + us.getOrders().get(num).getDate());
        }else  if (us.getOrders().get(num).getIsComplete() == 2) {
            System.out.println("店家： " + us.getOrders().get(num).getShop() + " | 已接单 | 价格：" + us.getOrders().get(num).getMoney() + " | 日期：" + us.getOrders().get(num).getDate());
        }else  if (us.getOrders().get(num).getIsComplete() == 3) {
            System.out.println("店家： " + us.getOrders().get(num).getShop() + " | 已完成 | 价格：" + us.getOrders().get(num).getMoney() + " | 日期：" + us.getOrders().get(num).getDate());
        }
        System.out.println("------------------------------------------------------------------------------------");
        for(int i=0;i<us.getOrders().get(num).getOdmu().size();i++){
            System.out.println(us.getOrders().get(num).getOdmu().get(i).getName()+"----"+us.getOrders().get(num).getOdmu().get(i).getMount()+"份");
        }

        System.out.println("请按0退出");
    }

    /**查看评论历史*/
    public static void checkComment(User us){
        for(int i=0;i<us.getComments().size();i++){
            System.out.println(i+1+"店家： "+us.getComments().get(i).getShop()+" | "+us.getComments().get(i).getWriter()+" : "+us.getComments().get(i).getComm()+" | "+us.getComments().get(i).getDate());
        }
        System.out.println("请按0退出");
    }

    /**显示所有商家*/
    public static void showAllBusiness(List<Business> list) {

            System.out.println("-----------------------");
            System.out.println("|欢迎来到广东工业大学外卖系统|");
            System.out.println("-----------------------");
            for (int i = 0; i < list.size(); i++) {
                System.out.println(i + 1 + "、 " + list.get(i).getShopname() + " | " + list.get(i).getIndroduce());
            }
            System.out.println("请按0退出 | 输入商家编号查看详情");

    }

    /**展示某商家和他的菜单*/
    public static void showBusiness(Business bu){
        System.out.println("----------------------------------------------");
        System.out.println(bu.getShopname());
        System.out.println(bu.getIndroduce());
        System.out.println("----------------------------------------------");
        for(int i=0;i<bu.getMenu().size();i++){
            System.out.println(i+1+"、 "+bu.getMenu().get(i).getName()+" | "+bu.getMenu().get(i).getIntroduce()+" | "+bu.getMenu().get(i).getPrice());
        }
    }

}
